home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Utilities Professional 1-1500
/
Utilities Professional 1-1500 (1994)(WPD)[!].iso
/
12511500
/
var1411.dms
/
var1411.adf
/
docs
/
Demo.doc
< prev
next >
Wrap
Text File
|
1993-07-23
|
3KB
|
71 lines
The demo is just a three dimensional starfield with a sinusoidal scrolltext
which I wrote a while ago. It demonstrates just how naughty you can be when
writing programs, to squeeze the most speed out of the computer. Hopefully it
will work on all Amigas, but I wouldn't bet on it, as it hits the hardware
directly, and does other such naughty things.
The demo works as two separate tasks:
1) starfield
2) scrolling message
The scrolling message is the most important thing, and is handled via an
interrupt. The best way to look at how the message is produced is to consider
two screen refreshes
After the television scan line has passed the bottom of the message boundary,
a routine in the copper list programs the blitter to clear the bit plane used
for the message. Then a few scan lines later, well after the blitter has
completed, the copper list then causes a copper interrupt. This interrupt
routine draws the scrolling message on the screen, and finishes it before the
television scan line meets the top line of the scrolling message.
The scrolling message routine then does nothing until after the television
scan line has passed the bottom of the message, in which case, the message
routine repeats.
To get the sinusoidal movement, the message is split into vertical lines,
with each line being one vertical pixel of a character. These lines are
moved from the left of the screen to the right. To make the effect more
interesting, the displacement of the lines is provided by a sine wave of
various frequency and amplitude moving from right to left
The message is more efficiently produced by drawing every other pixel of the
message, and then using the blitter to copy the whole message one pixel to
the right (almost halves the time take to display the message)
The stars are moved when the processor is not drawing the message, and when
the blitter is clearing the message (the star drawing routine doesn't use the
blitter, so this is allowable). The stars are moved as quickly as possible,
and so each star doesn't necessarily move once per frame. The number of stars
in the demo can be altered by changing the value of NumberStars in the source
code.
Each movement of the stars allows the star to be moved in one plane, and also
to be roatated in one plane.
Please note that when you are doing very naughty things such as programming
the blitter with a copper list, then you have to be exteremly careful when
shutting down the demo, and returning to the workbench screen, as it is very
easy to crash the machine. For example, see the shut down code in this demo.
There is no music in this demo for two reasons:
1) I cannot write music
2) Adding a protracker replay routine would only make the source file longer
and cloud matters further. Although adding one would be simple. Just add
the music source, and in the interrupt handler before the line:
bsr.s DoScroll
add:
bsr mt_music
Or whatever the routine is that needs to be called every vertical blank.
also add branch subroutines to the mt_init & mt_end routines in the
startup and shutdown code.